j3deditor.bin.hierarchy
Class VirtualVertex

java.lang.Object
  extended by j3deditor.bin.hierarchy.Vertex
      extended by j3deditor.bin.hierarchy.VirtualVertex

public class VirtualVertex
extends Vertex

Represents a vertex that contains its own vertex data.

Author:
Risto Seene

Field Summary
 
Fields inherited from class j3deditor.bin.hierarchy.Vertex
COORDINATE_VERTEX_STATE, HIDDEN, inUse, NORMAL, SELECTED, TEXTURE_VERTEX_STATE, TRANSFORMABLE
 
Constructor Summary
protected VirtualVertex(J3DeGeometryArray g, float x, float y, float z, int index)
          Creates an instance of VirtualVertex with the specified coordinates and initializes its components which are required by J3DeGeometryArray.
protected VirtualVertex(J3DeGeometryArray g, int index)
          Creates an instance of VirtualVertex and initializes its components which are required by J3DeGeometryArray.
protected VirtualVertex(J3DeGeometryArray g, javax.vecmath.Point3f loc, int index)
          Creates an instance of VirtualVertex with the specified coordinates and initializes its components which are required by J3DeGeometryArray.
protected VirtualVertex(Vertex vertex)
          Creates an instance of VirtualVertex and copies all vertex data from the specified vertex to this vertex.
 
Method Summary
 float[] getColor()
          Returns the color of this vertex.
 javax.vecmath.Point3f getCoordinate()
          Returns the positional coordinates of this vertex.
 float[] getCoordinates()
          Returns the positional coordinates of this vertex (X, Y, Z).
 javax.vecmath.Vector3f getNormal()
          Returns the normal vector of this vertex.
 float getZ()
          Returns the Z-coordinate of this vertex.
 float getTex(int axis, int texCoordSet)
          Returns a texture coordinate of this vertex in the specified texture coordinate set.
 float[] getTexCoordinates(int texCoordSet)
          Returns texture coordinates of this vertex in the specified texture coordinate set.
 float getX()
          Returns the X-coordinate of this vertex.
 float getY()
          Returns the Y-coordinate of this vertex.
 void setColor(float[] color)
          Sets the color of this vertex.
 void setCoordinate(javax.vecmath.Point3f coordinates)
          Sets the positional coordinates of this vertex.
 void setCoordinates(float[] coordinates)
          Sets the positional coordinates of this vertex.
 void setNormal(javax.vecmath.Vector3f normal)
          Sets the normal vector of this vertex.
 void setZ(float z)
          Sets the Z coordinate of this vertex.
 void setTex(float coordinate, int axis, int texCoordSet)
          Sets a texture coordinate of this vertex.
 void setTexCoordinates(float[] coordinates, int texCoordSet)
          Sets the texture coordinates of this vertex.
 void setX(float x)
          Sets the X coordinate of this vertex.
 void setY(float y)
          Sets the Y coordinate of this vertex.
 void translate(float[] xyz)
          Translates this vertex.
 void translateZ(float z)
          Changes the Z coordinate of this vertex.
 void translateTex(float[] trans, int texCoordSet)
          Changes texture coordinates of this vertex.
 void translateX(float x)
          Changes the X coordinate of this vertex.
 void translateY(float y)
          Changes the Y coordinate of this vertex.
 
Methods inherited from class j3deditor.bin.hierarchy.Vertex
equals, getAlpha, getGeometry, getIndex, getRGB, getState, set, setAlpha, setData, setIndex, setRGB, setState, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualVertex

protected VirtualVertex(J3DeGeometryArray g,
                        int index)
Creates an instance of VirtualVertex and initializes its components which are required by J3DeGeometryArray.

Parameters:
g - J3DeGeometryArray
index - the index of this vertex

VirtualVertex

protected VirtualVertex(J3DeGeometryArray g,
                        javax.vecmath.Point3f loc,
                        int index)
Creates an instance of VirtualVertex with the specified coordinates and initializes its components which are required by J3DeGeometryArray.

Parameters:
g - J3DeGeometryArray
loc - positional coordinates
index - the index of this vertex

VirtualVertex

protected VirtualVertex(J3DeGeometryArray g,
                        float x,
                        float y,
                        float z,
                        int index)
Creates an instance of VirtualVertex with the specified coordinates and initializes its components which are required by J3DeGeometryArray.

Parameters:
g - J3DeGeometryArray
x - X coordiante
y - Y coordiante
z - Z coordiante
index - the index of this vertex

VirtualVertex

protected VirtualVertex(Vertex vertex)
Creates an instance of VirtualVertex and copies all vertex data from the specified vertex to this vertex.

Parameters:
vertex - vertex which data will be copied to this vertex
Method Detail

getCoordinates

public float[] getCoordinates()
Returns the positional coordinates of this vertex (X, Y, Z).

Overrides:
getCoordinates in class Vertex
Returns:
the positional coordinates of this vertex

getTexCoordinates

public float[] getTexCoordinates(int texCoordSet)
Returns texture coordinates of this vertex in the specified texture coordinate set. Number of coordinate axes depends on the type of texture coordinates.

Overrides:
getTexCoordinates in class Vertex
Parameters:
texCoordSet - texture coordinate set
Returns:
texture coordinates of this vertex in the specified texture coordinate set

getTex

public float getTex(int axis,
                    int texCoordSet)
Returns a texture coordinate of this vertex in the specified texture coordinate set.

Overrides:
getTex in class Vertex
Parameters:
axis - coordinate axis: S, T, R or Q
texCoordSet - texture coordinate set
Returns:
a texture coordinate of this vertex in the specified texture coordinate set

getX

public float getX()
Returns the X-coordinate of this vertex.

Overrides:
getX in class Vertex
Returns:
the X-coordinate of this vertex

getY

public float getY()
Returns the Y-coordinate of this vertex.

Overrides:
getY in class Vertex
Returns:
the Y-coordinate of this vertex

getZ

public float getZ()
Returns the Z-coordinate of this vertex.

Overrides:
getZ in class Vertex
Returns:
the Z-coordinate of this vertex

setCoordinates

public void setCoordinates(float[] coordinates)
Sets the positional coordinates of this vertex.

Overrides:
setCoordinates in class Vertex
Parameters:
coordinates - new position of this vertex

setTexCoordinates

public void setTexCoordinates(float[] coordinates,
                              int texCoordSet)
Sets the texture coordinates of this vertex.

Overrides:
setTexCoordinates in class Vertex
Parameters:
coordinates - new texture coordinates
texCoordSet - texture coordinate set

setX

public void setX(float x)
Sets the X coordinate of this vertex.

Overrides:
setX in class Vertex
Parameters:
x - new X coordinate

setY

public void setY(float y)
Sets the Y coordinate of this vertex.

Overrides:
setY in class Vertex
Parameters:
y - new Y coordinate

setZ

public void setZ(float z)
Sets the Z coordinate of this vertex.

Overrides:
setZ in class Vertex
Parameters:
z - new Z coordinate

translate

public void translate(float[] xyz)
Translates this vertex.

Overrides:
translate in class Vertex
Parameters:
xyz - change of position on each axis

translateTex

public void translateTex(float[] trans,
                         int texCoordSet)
Changes texture coordinates of this vertex.

Overrides:
translateTex in class Vertex
Parameters:
trans - change of coordinates on S and T axis
texCoordSet - texture coordinate set

translateX

public void translateX(float x)
Changes the X coordinate of this vertex.

Overrides:
translateX in class Vertex
Parameters:
x - change of position on X axis

translateY

public void translateY(float y)
Changes the Y coordinate of this vertex.

Overrides:
translateY in class Vertex
Parameters:
y - change of position on Y axis

translateZ

public void translateZ(float z)
Changes the Z coordinate of this vertex.

Overrides:
translateZ in class Vertex
Parameters:
z - change of position on Z axis

getCoordinate

public javax.vecmath.Point3f getCoordinate()
Returns the positional coordinates of this vertex.

Overrides:
getCoordinate in class Vertex
Returns:
the positional coordinates of this vertex

getNormal

public javax.vecmath.Vector3f getNormal()
Returns the normal vector of this vertex.

Overrides:
getNormal in class Vertex
Returns:
the normal vector of this vertex

setNormal

public void setNormal(javax.vecmath.Vector3f normal)
Sets the normal vector of this vertex.

Overrides:
setNormal in class Vertex
Parameters:
normal - normal vector

setCoordinate

public void setCoordinate(javax.vecmath.Point3f coordinates)
Sets the positional coordinates of this vertex.

Overrides:
setCoordinate in class Vertex
Parameters:
coordinates - new position of this vertex

getColor

public float[] getColor()
Returns the color of this vertex.

Overrides:
getColor in class Vertex
Returns:
the color of this vertex

setColor

public void setColor(float[] color)
Sets the color of this vertex.

Overrides:
setColor in class Vertex
Parameters:
color - R, G and B if COLOR_3
R, G, B and A if COLOR_3

setTex

public void setTex(float coordinate,
                   int axis,
                   int texCoordSet)
Sets a texture coordinate of this vertex.

Overrides:
setTex in class Vertex
Parameters:
coordinate - new texture coordinate
axis - coordinate axis: S, T, R or Q
texCoordSet - texture coordinate set